/**
 * @author LKQ
 * @date 2022/1/6 20:19
 * @description
 */
public class Solution {
    public static void main(String[] args) {
        Solution solution = new Solution();
        System.out.println(solution.thousandSeparator(123456789));
    }

    public String thousandSeparator(int n ) {
        String s = String.valueOf(n);
        int length = s.length();
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < length; i++) {
            if (i > 0 && (length - i) % 3 == 0) {
                sb.append(".").append(s.charAt(i));
            }else {
                sb.append(s.charAt(i));
            }
        }
        return sb.toString();
    }
}
